<?php

namespace app\admin\model;

use think\Model;


class Introduction extends Model
{

    

    

    // 表名
    protected $name = 'introduction';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'true';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'createtime_text',
    ];
    

    
    public function getTypeList()
    {
        return ['1' => __('玩法介绍'), '2' => __('新人帮助'), '3' => __('帮助中心')];
    }


    public function getTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function getCreateTimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['createtime']) ? $data['createtime'] : '');
        return is_numeric($value) ? date("Y-m-d H:i", $value) : $value;
    }


}
